﻿<UserControl x:Class="AutoLoL.Controls.EditBuildControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:controls="clr-namespace:AutoLoL.Controls"
             xmlns:converters="clr-namespace:AutoLoL.Converters"
             x:Name="Root"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="800">
    <UserControl.Resources>
        <converters:SummonerSpellToVisibilityConverter x:Key="SummonerSpellToVisibilityConverter" />
    </UserControl.Resources>
    <DockPanel LastChildFill="True">
        <Grid Margin="0 0 0 10" DockPanel.Dock="Top">
            <StackPanel Orientation="Horizontal">
                <Button Width="75" Height="23" Click="SaveButton_Click" DockPanel.Dock="Left" HorizontalContentAlignment="Left">
                    <Button.Content>
                        <StackPanel Orientation="Horizontal">
                            <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/disk.png" />
                            <TextBlock Margin="5 0 0 0" Text="Save" />
                        </StackPanel>
                    </Button.Content>
                </Button>
                <Button Width="75" Height="23" Margin="10 0 0 0" DockPanel.Dock="Left"  Click="CancelButton_Click" HorizontalContentAlignment="Left">
                    <Button.Content>
                        <StackPanel Orientation="Horizontal">
                            <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/cross.png" />
                            <TextBlock Margin="5 0 0 0" Text="Cancel" />
                        </StackPanel>
                    </Button.Content>
                </Button>
            </StackPanel>
            <Button Width="75" Height="23" Name="DeleteButton" HorizontalAlignment="Right" Click="DeleteButton_Click" HorizontalContentAlignment="Left">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/trash.gif" />
                        <TextBlock Margin="5 0 0 0" Text="Delete" />
                    </StackPanel>
                </Button.Content>
            </Button>
        </Grid>
        <TabControl>
            <TabItem Header="Build">
                <StackPanel Margin="2">
                    <TextBlock Name="LastUpdateTextBlock" FontSize="10" Text="Last Update: yesterday" />
                    <StackPanel Orientation="Horizontal" Margin="0 0 0 5" >
                        <TextBlock FontSize="16" Name="ChampionNameTextBlock" FontWeight="Bold" Text="" />
                        <TextBlock FontSize="14" Name="ChampionDescriptionTextBlock" VerticalAlignment="Bottom" Margin="5 0 0 1" Text="" />
                    </StackPanel>
                    <DockPanel LastChildFill="True">
                        <Border BorderBrush="DimGray" BorderThickness="1" DockPanel.Dock="Left">
                            <Grid MouseDown="ChampionGrid_MouseDown" Background="#22FFFFFF" Cursor="Hand" ToolTip="Click to select a champion">
                                <Image Name="ChampionImage" Width="90" Height="90" />
                            </Grid>
                        </Border>
                        <StackPanel Margin="10 0 10 0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="105" />
                                    <ColumnDefinition Width="10" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="5" />
                                    <RowDefinition />
                                    <RowDefinition Height="5" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>

                                <TextBlock Text="Build Title:" Grid.Column="0" Grid.Row="0" />
                                <TextBlock Text="Items:" Grid.Column="0" Grid.Row="2" />
                                <TextBlock Text="Summoner Spells:" Grid.Column="0" Grid.Row="4" />

                                <Grid Grid.Column="2" Grid.Row="0">
                                    <TextBox Name="TitleTextBox" Width="220" HorizontalAlignment="Left" />
                                    <ComboBox Name="GameTypeComboBox" Margin="243,1,211,0" />
                                </Grid>
                                <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="2">
                                    <Border BorderBrush="DimGray" BorderThickness="1">
                                        <Grid Name="Item1Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="ItemGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                        </Grid>
                                    </Border>
                                    <Border BorderBrush="DimGray" BorderThickness="1" Margin="5 0 0 0">
                                        <Grid Name="Item2Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="ItemGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                        </Grid>
                                    </Border>
                                    <Border BorderBrush="DimGray" BorderThickness="1" Margin="5 0 0 0">
                                        <Grid Name="Item3Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="ItemGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                        </Grid>
                                    </Border>
                                    <Border BorderBrush="DimGray" BorderThickness="1" Margin="5 0 0 0">
                                        <Grid Name="Item4Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="ItemGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                        </Grid>
                                    </Border>
                                    <Border BorderBrush="DimGray" BorderThickness="1" Margin="5 0 0 0">
                                        <Grid Name="Item5Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="ItemGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                        </Grid>
                                    </Border>
                                    <Border BorderBrush="DimGray" BorderThickness="1" Margin="5 0 0 0">
                                        <Grid Name="Item6Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="ItemGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                        </Grid>
                                    </Border>
                                    <Button Height="23" HorizontalContentAlignment="Left" Name="importDefaultItemsButton" Click="ImportDefaultItemsButton_Click" Width="114" BorderThickness="1" Margin="5,0,0,0" ToolTip="Import items from deployed to LoL items (item defaults that where changed).">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Height="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/document-import.png" Width="16" />
                                            <TextBlock Margin="5 0 0 0" Text="Import Defaults" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="4">
                                    <Border BorderBrush="DimGray" BorderThickness="1">
                                        <Grid Name="Spell1Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="SpellGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                            <Rectangle Fill="#88FFFFFF">
                                                <Rectangle.Visibility>
                                                    <MultiBinding Converter="{StaticResource SummonerSpellToVisibilityConverter}" ConverterParameter="True">
                                                        <Binding Path="DataContext" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Grid}}" />
                                                        <Binding ElementName="MasteryEditorViewbox" Path="Child.MasteryBuild.ImprovedSummonerSpells" />
                                                    </MultiBinding>
                                                </Rectangle.Visibility>
                                            </Rectangle>
                                        </Grid>
                                    </Border>
                                    <Border BorderBrush="DimGray" BorderThickness="1" Margin="5 0 0 0">
                                        <Grid Name="Spell2Grid" Cursor="Hand" Background="Transparent" MouseLeftButtonDown="SpellGrid_MouseLeftButtonDown">
                                            <Image Source="{Binding IconBitmapImage}" Width="32" Height="32" />
                                            <Rectangle Fill="#77FFFFFF">
                                                <Rectangle.Visibility>
                                                    <MultiBinding Converter="{StaticResource SummonerSpellToVisibilityConverter}" ConverterParameter="True">
                                                        <Binding Path="DataContext" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Grid}}" />
                                                        <Binding ElementName="MasteryEditorViewbox" Path="Child.MasteryBuild.ImprovedSummonerSpells" />
                                                    </MultiBinding>
                                                </Rectangle.Visibility>
                                            </Rectangle>
                                        </Grid>
                                    </Border>
                                    <Button Width="23" Height="23" Click="SwapButton_Click" Margin="5 0 0 0" VerticalAlignment="Bottom">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/swap.png" />
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>
                                </StackPanel>
                            </Grid>
                        </StackPanel>
                    </DockPanel>
                    <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
                        <StackPanel Margin="0 0 10 0" Width="94">
                            <Button Width="81" Height="75" Name="RunButton" Click="RunButton_Click" HorizontalContentAlignment="Center">
                                <Button.Content>
                                    <StackPanel>
                                        <Image Height="32" Width="32" Source="pack://siteoforigin:,,,/Data/Images/Icons/play.png" />
                                        <TextBlock Text="Start clicker!" />
                                    </StackPanel>
                                </Button.Content>
                            </Button>
                            <Button Width="81" Height="23" HorizontalContentAlignment="Center" Name="DeployButton"  Margin="0,5,0,0" Click="onDeployItems">
                                <StackPanel>
                                    <TextBlock Text="Deploy Items" />
                                </StackPanel>
                            </Button>
                            <Button Width="81" Height="23" Margin="0 10 0 0" Name="ImportButton" Click="ImportButton_Click" HorizontalContentAlignment="Left">
                                <Button.Content>
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                                        <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/document-import.png" />
                                        <TextBlock Margin="5 0 0 0" Text="Import" />
                                    </StackPanel>
                                </Button.Content>
                            </Button>
                        </StackPanel>
                        <Viewbox Height="341" Width="546" Name="MasteryEditorViewbox">
                            <!--<controls:MasteryEditorControl x:Name="MasteryEditorControl" />-->
                        </Viewbox>
                    </StackPanel>
                </StackPanel>
            </TabItem>
            <TabItem Header="Guide">
                <DockPanel LastChildFill="True" Margin="2">
                    <StackPanel Margin="0 0 0 10" Orientation="Horizontal" DockPanel.Dock="Top" HorizontalAlignment="Left">
                        <Button Width="75" Height="23" Name="ViewButton" Click="ViewButton_Click" HorizontalAlignment="Left" HorizontalContentAlignment="Left">
                            <Button.Content>
                                <StackPanel Orientation="Horizontal">
                                    <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/document.png" />
                                    <TextBlock Margin="5 0 0 0" Text="View" />
                                </StackPanel>
                            </Button.Content>
                        </Button>
                        <Button Width="75" Height="23" Name="EditButton" Click="EditButton_Click" HorizontalAlignment="Left" HorizontalContentAlignment="Left">
                            <Button.Content>
                                <StackPanel Orientation="Horizontal">
                                    <Image Height="16" Width="16" Source="pack://siteoforigin:,,,/Data/Images/Icons/pencil.png" />
                                    <TextBlock Margin="5 0 0 0" Text="Edit" />
                                </StackPanel>
                            </Button.Content>
                        </Button>
                    </StackPanel>
                    <Grid>
                        <TextBox AcceptsReturn="True" Height="Auto" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" Name="GuideTextBox" />
                        <ScrollViewer Name="GuideScrollViewer" Height="Auto" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Visible">
                            <Grid Name="GuideGrid" />
                        </ScrollViewer>
                    </Grid>
                </DockPanel>
            </TabItem>
        </TabControl>
    </DockPanel>
</UserControl>
